---
title: Plate Core
description: API reference for @udecode/plate-core.
---

## API

### createPlateEditor

Generates a new instance of a `PlateEditor`, initialized with a set of plugins and their configurations.

<APIParameters>
  <APIItem name="options" type="CreatePlateEditorOptions<V, E>">
    Options for creating the Plate editor.
    <APISubList>
      <APISubListItem parent="options" name="id" type="any" optional>
        Unique identifier for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="editor" type="E" optional>
        Initial editor without `withPlate`.
      </APISubListItem>
      <APISubListItem parent="options" name="plugins" type="P[]" optional>
        An array of editor plugins.
      </APISubListItem>
      <APISubListItem parent="options" name="value" type="V" optional>
        Initial value of the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="autoSelect" type="'end' | 'start' | boolean" optional>
        Select the editor after initialization.
        - **Default:** `false`
        - `true` | 'end': Select the end of the editor
        - `false`: Do not select anything
        - `'start'`: Select the start of the editor
      </APISubListItem>
      <APISubListItem parent="options" name="maxLength" type="number" optional>
        Specifies the maximum number of characters allowed in the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="selection" type="TSelection" optional>
        Initial selection for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="shouldNormalizeEditor" type="boolean" optional>
        When `true`, it will normalize the initial `value` passed to the `editor`.
        - **Default:** `false`
      </APISubListItem>
      <APISubListItem parent="options" name="rootPlugin" type="(plugin: AnyPlatePlugin) => AnyPlatePlugin" optional>
        Function to configure the root plugin.
      </APISubListItem>
      <APISubListItem parent="options" name="api" type="object" optional>
        API methods for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="decorate" type="function" optional>
        Decoration function for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="extendEditor" type="function" optional>
        Function to extend the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="handlers" type="object" optional>
        Event handlers for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="inject" type="object" optional>
        Injection configuration for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="normalizeInitialValue" type="function" optional>
        Function to normalize the initial value.
      </APISubListItem>
      <APISubListItem parent="options" name="options" type="object" optional>
        Additional options for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="override" type="object" optional>
        Override configuration for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="priority" type="number" optional>
        Priority of the editor plugin.
      </APISubListItem>
      <APISubListItem parent="options" name="render" type="object" optional>
        Render functions for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="shortcuts" type="object" optional>
        Keyboard shortcuts for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="transforms" type="object" optional>
        Transform functions for the editor.
      </APISubListItem>
      <APISubListItem parent="options" name="useHooks" type="function" optional>
        Hook to use with the editor.
      </APISubListItem>
    </APISubList>
  </APIItem>
</APIParameters>

<APIReturns>
  An instance of `PlateEditor` with the specified plugins and settings applied.
</APIReturns>

For more details on editor configuration, refer to the [Editor Configuration](/docs/editor) guide.

### createPlatePlugin

Creates a new Plate plugin with the given configuration, supporting extension, nested plugin manipulation, and runtime configuration.

<APIParameters>
  <APIItem name="config" type="PlatePluginConfig<K, O, A, T> | ((editor: PlateEditor) => PlatePluginConfig<K, O, A, T>)">
    The configuration object for the plugin, or a function that returns the configuration. If a function is provided, it will be executed when the plugin is resolved with the editor.

    For details on the `PlatePluginConfig` type, refer to the [PlatePlugin API](/docs/api/core/plate-plugin#plugin-properties).
  </APIItem>
</APIParameters>

<APIReturns>
  A new `PlatePlugin<PluginConfig<K, O, A, T>>` instance.
</APIReturns>

### createTPlatePlugin

Explicitly typed version of `createPlatePlugin`.

<APIParameters>
  <APIItem name="config" type="TPlatePluginConfig<C> | ((editor: PlateEditor) => TPlatePluginConfig<C>)">
    The configuration object for the plugin, or a function that returns the configuration. This version requires an explicit type parameter `C` extending `AnyPluginConfig`.

    For details on the `TPlatePluginConfig` type, refer to the [PlatePlugin API](/docs/api/core/plate-plugin#plugin-properties).
  </APIItem>
</APIParameters>

<APIReturns>
  A new `PlatePlugin<C>` instance.
</APIReturns>

### toPlatePlugin

Extends a SlatePlugin to create a React PlatePlugin.

<APIParameters>
  <APIItem name="basePlugin" type="SlatePlugin<C>">
    The base SlatePlugin to be extended.
  </APIItem>
  <APIItem name="extendConfig" type="PlatePluginConfig<C, EO, EA, ET> | ((ctx: PlatePluginContext<C>) => PlatePluginConfig<C, EO, EA, ET>)" optional>
    A function or object that provides the extension configuration. If a function, it receives the plugin context and should return a partial PlatePlugin. If an object, it should be a partial PlatePlugin configuration.
  </APIItem>
</APIParameters>

<APIReturns>
  A new `PlatePlugin` that combines the base SlatePlugin functionality with React-specific features defined in the extension configuration.
</APIReturns>

### toTPlatePlugin

Explicitly typed version of `toPlatePlugin`.

<APIParameters>
  <APIItem name="basePlugin" type="SlatePlugin<TContext>">
    The base SlatePlugin to be extended.
  </APIItem>
  <APIItem name="extendConfig" type="ExtendPluginConfig<C> | ((ctx: PlatePluginContext<TContext>) => ExtendPluginConfig<C>)" optional>
    A function or object that provides the extension configuration. This version requires explicit type parameters for both the base plugin configuration (`TContext`) and the extension configuration (`C`).
  </APIItem>
</APIParameters>
a
<APIReturns>
  A new `PlatePlugin` with precise type control.
</APIReturns>

### useEditorPlugin

Get editor and plugin context.

<APIParameters>
  <APIItem name="p" type="WithRequiredKey<P>">
    The plugin or plugin configuration with a required key.
  </APIItem>
</APIParameters>

<APIReturns>
  A `PlatePluginContext` object containing:
  <APISubList>
    <APISubListItem parent="PlatePluginContext" name="editor" type="PlateEditor">
      The current editor instance.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="plugin" type="PlatePlugin">
      The plugin instance.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="getOption" type="function">
      Function to get a specific option value.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="getOptions" type="function">
      Function to get all options for the plugin.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="setOption" type="function">
      Function to set a specific option value.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="setOptions" type="function">
      Function to set multiple options.
    </APISubListItem>
    <APISubListItem parent="PlatePluginContext" name="useOption" type="function">
      Hook to subscribe to a specific option value in a React component.
    </APISubListItem>
  </APISubList>
</APIReturns>

### useEditorRef

Get the Slate editor reference without re-rendering.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor. Useful only when nesting editors. Default is using the closest editor id.
  </APIItem>
</APIParameters>
<APIReturns>
  A `PlateEditor` object, which is the Slate editor.
</APIReturns>

### useEditorSelector

Subscribe to a specific property of the editor.

<APIParameters>
  <APIItem name="selector" type="(editor: PlateEditor<V>, prev?: T) => T">
    The selector function.
  </APIItem>
  <APIItem name="deps" type="DependencyList">
    The dependency list for the selector function.
  </APIItem>
  <APIItem name="options" type="UseEditorSelectorOptions<T>" optional>
    <APISubList>
      <APISubListItem parent="options" name="id" type="string" optional>
        The ID of the plate editor. Useful only when nesting editors. Default is using the closest editor id.
      </APISubListItem>
      <APISubListItem parent="options" name="equalityFn" type="(a: T, b: T) => boolean" optional>
        Equality function to determine whether the result of the selector function has changed. Default is `(a, b) => a === b`.
      </APISubListItem>
    </APISubList>
  </APIItem>
</APIParameters>
<APIReturns>
  The return value of the selector function.
</APIReturns>

### useEditorState

Get the Slate editor reference with re-rendering.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor. Default is using the closest editor id.
  </APIItem>
</APIParameters>
<APIReturns>
  A `PlateEditor` object, which is the Slate editor.
</APIReturns>

### useEditorReadOnly

Get the editor's `readOnly` state.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor.
  </APIItem>
</APIParameters>
<APIReturns>
  The `readOnly` state of the editor.
</APIReturns>

### useEditorMounted

Get the editor's `isMounted` state.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor.
  </APIItem>
</APIParameters>
<APIReturns>
  The `isMounted` state of the editor.
</APIReturns>

### useEditorSelection

Get the editor's selection. Memoized so it does not re-render if the range is the same.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor.
  </APIItem>
</APIParameters>
<APIReturns>The current selection in the editor.</APIReturns>

### useEditorVersion

Get the version of the editor value. That version is incremented on each editor change.

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor.
  </APIItem>
</APIParameters>
<APIReturns>The current version of the editor value.</APIReturns>

### useSelectionVersion

Get the version of the editor selection. That version is incremented on each selection change (the range being different).

<APIParameters>
  <APIItem name="id" type="string" optional>
    The ID of the plate editor.
  </APIItem>
</APIParameters>
<APIReturns>The current version of the editor selection.</APIReturns>

## Core plugins

### DebugPlugin
Provides debugging capabilities with configurable log levels and error handling. 

See [Debugging](/docs/debugging) for more details.

### SlateNextPlugin
Extend core apis and improve default functionality.

### DOMPlugin & ReactPlugin
Integrates React-specific functionality into the editor.

### HistoryPlugin
Enables undo and redo functionality for the editor.

### InlineVoidPlugin
Manages inline and void elements in the editor.

### ParserPlugin
Handles parsing of content for the editor.

### LengthPlugin
Enforces a maximum length for the editor content.

### HtmlPlugin
Enables HTML serialization and deserialization.

### AstPlugin
Handles Abstract Syntax Tree (AST) operations for the editor.

### ParagraphPlugin
Provides paragraph formatting functionality.

### EventEditorPlugin
Manages editor events such as focus and blur.

### PlateApiPlugin
Provides the core API for Plate editor functionality.
